package beans;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import model.ConnectDb;
import dao.JDBCLogarUsuarioDAO;
import dao.PersistConexao;

public class SelectEmpresa {

	private ConnectDb connectdb = new ConnectDb();
	private String schema = connectdb.getSchema_producao();
	private String user = connectdb.getUser();
	private String pass = connectdb.getPass();

	public static String empresa;
	private Map<String, String> empresacliente = new HashMap<String, String>();

	public SelectEmpresa() {

		List<String> result = new ArrayList<String>();
		PersistConexao persistconexao = new PersistConexao();
		Connection conexao = persistconexao.openConecao(schema, user, pass);
		JDBCLogarUsuarioDAO dao = new JDBCLogarUsuarioDAO(conexao);

		result = dao.ListarEmpresa(empresa);
		int tam = result.size();
		int tamanho = 0;
		empresacliente = new HashMap<String, String>();

		while (tamanho <= (tam - 1)) {
			empresacliente.put(result.get(tamanho), result.get(tamanho));
			tamanho++;
		}
		persistconexao.closeConexao();
	}

	public String getSchema() {
		return schema;
	}

	public void setSchema(String schema) {
		this.schema = schema;
	}

	public String getUser() {
		return user;
	}

	public void setUser(String user) {
		this.user = user;
	}

	public String getPass() {
		return pass;
	}

	public void setPass(String pass) {
		this.pass = pass;
	}

	public String getEmpresa() {
		return empresa;
	}

	public void setEmpresa(String empresa) {
		this.empresa = empresa;
	}

	public Map<String, String> getEmpresacliente() {
		return empresacliente;
	}

	public void setEmpresacliente(Map<String, String> empresacliente) {
		this.empresacliente = empresacliente;
	}

}
